home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / stdio / Makefile < prev    next >
Makefile  |  1994-05-23  |  4KB  |  111 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Specific makefile for stdio.
  21. #
  22. subdir    := stdio
  23.  
  24. headers    := stdio.h stdio_lim.h printf.h
  25.  
  26. routines    :=                                  \
  27.     ctermid cuserid                                  \
  28.     feof ferror clearerr fileno                          \
  29.     newstream fopen freopen fdopen fopncook fmemopen              \
  30.     setbuf setvbuf setbuffer setlinebuf                      \
  31.     fseek ftell rewind fgetpos fsetpos                      \
  32.     vfprintf vprintf printf_fp reg-printf printf-prs _itoa              \
  33.     vsnprintf vsprintf vasprintf                                \
  34.     fprintf printf snprintf sprintf asprintf                  \
  35.     dprintf vdprintf                              \
  36.     __vfscanf vfscanf vscanf __vsscanf vsscanf                  \
  37.     fscanf scanf sscanf                              \
  38.     fread fwrite                                  \
  39.     ungetc                                      \
  40.     fgetc getc getchar getw                              \
  41.     fputc putc putchar putw                              \
  42.     fgets gets fputs puts                              \
  43.     getdelim getline __getdelim __getline                      \
  44.     perror psignal                                  \
  45.     tmpfile tmpnam tempnam tempname                          \
  46.     fclose fflush                                  \
  47.     remove rename                                  \
  48.     memstream obstream                              \
  49.     internals sysd-stdio pipestream stdio_init libc_fatal
  50.  
  51. # Several mpn functions from GNU MP are used by the printf_fp function.
  52. mpn-routines := add_1 add_n addmul_1 cmp divmod divmod_1 udiv_qrnnd \
  53.         lshift rshift mod_1 mul mul_1 mul_n sub_n submul_1 
  54. mpn-headers = longlong.h gmp.h gmp-impl.h gmp-mparam.h asm.h
  55.  
  56. routines := $(strip $(routines) $(mpn-routines)) dbl2mpn
  57. aux    := errlist siglist defs syms-stdio glue mp_clz_tab
  58. distribute = $(mpn-headers) mpn-copy.mk _itoa.h
  59.  
  60. tests := tst-printf tstscanf test_rdwr test-popen tstgetln test-fseek \
  61.      bug1 bug2 bug3 bug4 bug5 bug6 temptest tst-fileno xbug
  62.  
  63.  
  64. include ../Rules
  65.  
  66.  
  67. ifdef gmp-srcdir
  68.  
  69. gmp-srcdir := $(firstword $(filter-out ..//%,$(..)$(gmp-srcdir) $(gmp-srcdir)))
  70.  
  71. # Copy the mpn source files we use from the GNU MP source directory.
  72. # `gmp-srcdir' is set by doing `configure --with-gmp=DIR'.
  73. # (Do not try this at home.  You need an as yet unreleased version of GNU MP.)
  74.  
  75. mpn-sysdep := $(addsuffix .c,$(mpn-routines)) \
  76.           $(addsuffix .S,$(mpn-routines)) \
  77.           $(addsuffix .s,$(mpn-routines)) gmp-mparam.h asm.h
  78.  
  79. mpn-try := $(addprefix $(gmp-srcdir)/mpn/*/,$(mpn-sysdep))
  80. mpn-found := $(wildcard $(mpn-try))
  81. mpn-found := $(filter-out $(patsubst %.S,%.s,$(filter %.s,$(mpn-found))),\
  82.               $(mpn-found))
  83.  
  84. include mpn-copy.mk
  85. %.mk: gen-%; sh $< > $@
  86.  
  87. mpn-copy-1 := $(patsubst $(gmp-srcdir)/mpn/%,$(sysdep_dir)/%,$(mpn-found))
  88. mpn-copy-sysdep := $(mpn-copy-sysdep) $(mpn-copy-1)
  89. $(mpn-copy-1): $(sysdep_dir)/%: $(ignore gmp2glibc.sed) $(gmp-srcdir)/mpn/%
  90.     $(gmp2glibc)
  91.  
  92. mpn-stuff = $(mpn-copy-sysdep) $(mpn-copy)
  93.  
  94. # chmod so I don't edit them by mistake.
  95. define gmp2glibc
  96. $(ignore sed -f $^ > $@-tmp)
  97. cp $< $@-tmp
  98. chmod a-w $@-tmp
  99. mv -f $@-tmp $@
  100. endef
  101.  
  102. mpn-copy = $(filter-out $(mpn-sysdep),$(mpn-headers) mp_clz_tab.c)
  103. $(mpn-copy): %: $(ignore gmp2glibc.sed) $(gmp-srcdir)/%; $(gmp2glibc)
  104.  
  105. .PHONY: copy-mpn clean-mpn
  106. copy-mpn: $(mpn-stuff)
  107. clean-mpn:
  108.     rm -f $(mpn-stuff)
  109.  
  110. endif
  111.